<?php

namespace App\Models\Scenic;

use App\Models\Scenic\Order\ScenicOrderGoods;
use App\Models\Scenic\Order\ScenicOrderPassenger;
use App\Trip\Orders\TripOrderState;
use Illuminate\Database\Eloquent\Model;

class ScenicOrder extends Model
{

    const PROVIDER_ORDER_STATE_UNKNOWN = -1;
    const PROVIDER_ORDER_STATE_WAIT_SUBMIT = 0;
    const PROVIDER_ORDER_STATE_WAIT_PAY = 1;
    const PROVIDER_ORDER_STATE_SUBMIT = 2;
    const PROVIDER_ORDER_STATE_COMPLETE = 3;
    const PROVIDER_ORDER_STATE_CANCEL = 4;



    public function disableStates() :array
    {
        return [
            self::PROVIDER_ORDER_STATE_SUBMIT,
            self::PROVIDER_ORDER_STATE_COMPLETE,
        ];
    }

    public function passengers()
    {
        return $this->hasMany(ScenicOrderPassenger::class, "order_sn", "order_sn");
    }

    public function order_goods()
    {
        return $this->hasOne(ScenicOrderGoods::class, "order_sn", "order_sn");
    }


    public function getPaySn()
    {
        return $this->getAttribute('pay_sn');
    }

    public function getOrderState()
    {
        return $this->getAttribute('order_state');
    }

}
